package com.third.customer.service.data;

import com.third.customer.service.exception.ThirdBadRequestException;
import lombok.Data;
import org.springframework.util.StringUtils;

import javax.validation.constraints.NotEmpty;

/**
 * Created by hehuaichun on 2020/5/22.
 */
@Data
public class CustomerGroupReq {

    String name;

    String description;

    public void validateForCreate(){
        if(StringUtils.isEmpty(name)){
            throw new ThirdBadRequestException("客户组名称不能为空!");
        }
    }

    public void validateForModify(){
        if(StringUtils.isEmpty(name) && StringUtils.isEmpty(description)){
            throw new ThirdBadRequestException("你没有提交任何修改数据!");
        }
    }
}
